home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / RecordNumberLabel.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  1.5 KB  |  36 lines

  1. package symantec.itools.db.awt;
  2.  
  3. import java.awt.Label;
  4. import symantec.itools.db.pro.ProjBinder;
  5. import symantec.itools.db.pro.Record;
  6. import symantec.itools.db.pro.RecordLink;
  7. import symantec.itools.db.pro.RelationView;
  8. import symjava.sql.SQLException;
  9.  
  10. public class RecordNumberLabel extends Label implements RecordLink {
  11.    ProjBinder m_ProjBinder;
  12.  
  13.    public RecordNumberLabel() {
  14.       super("<Record Number Label>");
  15.    }
  16.  
  17.    public void init() {
  18.       ((Label)this).setText("Invalid");
  19.    }
  20.  
  21.    public void notifyRecordChange(Record currentRecord) throws SQLException {
  22.       if (currentRecord != null && currentRecord.getRelationView() != null) {
  23.          ((Label)this).setText(currentRecord.getRelationView().getCurrentRecordNumberString());
  24.       }
  25.  
  26.    }
  27.  
  28.    public void setRelationView(RelationView rv) {
  29.       try {
  30.          rv.bindCurrentRecord(this);
  31.       } catch (SQLException ex) {
  32.          System.out.println(((Throwable)ex).getMessage());
  33.       }
  34.    }
  35. }
  36.